#ifndef CONNECTLINEMIDRECT_H
#define CONNECTLINEMIDRECT_H

#include <QGraphicsItem>
#include <QObject>
#include <QPoint>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include <QGraphicsSceneMouseEvent>

class ConnectLineMidRect : public QObject , public QGraphicsRectItem
{
public:
    ConnectLineMidRect(QGraphicsItem* parent, QPointF* start, QPointF* end);
    QPainterPath shape() const override;
    QRectF boundingRect() const override;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
    void updatePosition();

    void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;

private:
    QPointF* m_start;
    QPointF* m_end;
    bool m_select;
};

#endif // CONNECTLINEMIDRECT_H
